<!DOCTYPE html>
<html lang="en">
<head>
	<meta name="viewport"
	      content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">

	<title>Instagram Brand Search | GugeeData</title>
	<meta name="description" content="Instantly find the popular brands on Instagram by using the Instagram Brand Search feature | GugeeData">
	<meta name="keywords" content="Instagram brand, Instagram marketing">
	<meta property="og:title" content="Instagram Brand Search | GugeeData">
	<meta property="og:description" content="Instantly find the popular brands on Instagram by using the Instagram Brand Search feature | GugeeData">
	<meta property="og:type" content="website">
	<meta property="og:url" content="https://www.gugeedata.com/instagram/brand-search">
	<meta property="og:image" content=" https://seo-imags.s3.us-east-2.amazonaws.com/Logo.png">
	<meta name="twitter:title" content="Instagram Brand Search | GugeeDat">
	<meta name="twitter:description" content="Instantly find the popular brands on Instagram by using the Instagram Brand Search feature | GugeeData">

	<link rel="icon" href="/static/img/favicon.ico" type="image/x-icon"/>
	<link rel="shortcut icon" href="/static/img/favicon.ico" type="image/x-icon"/>
	<link rel="stylesheet" href="/static/css/ins/common.css">
    <#if isMobile == false>
		<link rel="stylesheet" href="/static/plugins/layui/layui.css">
		<link rel="stylesheet" href="/static/css/ins/search.css">
    <#else>
		<link rel="stylesheet" href="${request.contextPath}/static/css/ins/mobile/search.css">
    </#if>
	<link rel="stylesheet" href="/static/css/ins/media.css">
	<link rel="stylesheet" href="/static/css/ins/brand.css">
    <#include "../../component/facebookPixel.ftl">
</head>
<body>
<#include "../../header_new1.ftl">
<main>
    <#if isMobile == false>
		<section class="search-bg" id="userSearch">
			<div class="container">
				<h1>Instagram Brand Search</h1>
				<h2>Instantly find the popular brands on Instagram by using the Instagram brand search feature.</h2>
                <#include "../component/search/commonFilter.ftl">
			</div>
		</section>
        <#include "../component/search/commonWrap.ftl">
    <#else>
	    <section>
		    <div class="container">
			    <h1>Instagram Brand Search</h1>
			    <h2>Instantly find the popular brands on Instagram by using the Instagram brand search feature.</h2>
		    </div>
	    </section>
        <#include "../component/search/commonWrapMobile.ftl">
    </#if>
</main>
<script>
    const inputPlaceholder = 'Please enter brand name...'
    const initParams = {
        page: 1,
        pageSize: 10,
        sort: 3
    }
    let params = Object.assign({}, initParams)
    const tableHeader = [
        {
            label: 'Brand',
            align: 'left'
        },
        {
            label: 'Post',
            align: 'left',
            hasSort: true,
	        width: 150,
            sortIndex: 0,
            hasTip: true,
            tipContent: 'The number of media posts tagged/mentioned the brand<br>and product of the brand, and the number of media posted<br>by the brand\'s official account in the last 30 days.',
        },
        {
            label: 'Likes',
            hasSort: true,
            width: 150,
            sortIndex: 1,
            hasTip: true,
            tipContent: 'The number of likes of all the related media posts in the last 30 days.',
        },
        {
            label: 'Reviews',
            hasSort: true,
            width: 150,
            sortIndex: 2,
            hasTip: true,
            tipContent: 'The number of reviews of all the related media posts in the last 30 days.',
        },
        {
            label: 'Engagements',
            isActive: true,
            hasSort: true,
            width: 200,
            sortIndex: 3,
            hasTip: true,
            tipContent: 'The number of likes and reviews of all the related media posts in the last 30 days.',
        },
        {
            label: 'Action'
        }
    ]
    const filterList = [
        {
            label: 'Brand Categories',
            isMobileTab: true,
            requestOption: true,
            optionUrl: '/ins/dic/commercial/category',
        }
    ]
    const mobileSearchTab = [
        {
            label: 'Engagements',
            align: 'left',
            icon: 'icondown1',
            type: 1,
            options: [
                {
                    label: 'Post',
                    value: 0,
                },
                {
                    label: 'Likes',
                    value: 1,
                },
                {
                    label: 'Reviews',
                    value: 2,
                },
                {
                    label: 'Engagements',
                    value: 3,
                    isActive: true,
                },
            ]
        },
        {
            label: 'Tip',
            align: 'right',
            icon: 'iconfaq',
            hasTip: true,
            tipContent: '<dl class=\'modal-tip\'>' +
                '<dt>1. Posts</dt>' +
                '<dd>The number of media posts tagged/mentioned the brand and product of the brand, and the number of media posted by the brand\'s official account in the last 30 days.</dd>' +
                '<dt>2. Likes</dt>' +
                '<dd>The number of likes of all the related media posts in the last 30 days.</dd>' +
                '<dt>3. Reviews</dt>' +
                '<dd>The number of reviews of all the related media posts in the last 30 days.</dd>' +
                '<dt>4. Engagements</dt>' +
                '<dd>The number of likes and reviews of all the related media posts in the last 30 days.</dd>' +
                '</dl>'
        },
        {
            label: 'Category',
            align: 'right',
            icon: 'icondown1',
            type: 2,
            roleId: 2,
        },
    ]
</script>
<#include "../component/search/commonScript.ftl">
<script src="${request.contextPath}/static/js/dayjs.min.js"></script>
<script src="${request.contextPath}/static/js/time.js"></script>
<script src="/static/plugins/echarts.min.js"></script>
<script src="${request.contextPath}/static/js/gd-ui/popover/index.js"></script>
<script type="module">
    import { collectAction } from "/static/js/common.js"
    import CommonSearch from '/static/component/search/commonSearch.js'

    const commonSearch = new CommonSearch()
    commonSearch.setSearchFunc(searchUser)
    commonSearch.setReqFilterOptionsFunc(filterOptions)
    commonSearch.initRender()

    function filterOptions(res) {
        if (res[0].Code === 200) {
            let wrapStr = ''
            if(gugeeGobal.isMobile) {
                const wrap = document.querySelector('[data-sort-index="2"]')
                wrapStr += '<li class="is-active">All<div class="right"> <i class="iconfont iconzhichi"></i></div></li>'
                res[0].Data.forEach(item => {
                    wrapStr += '<li value="' + item.commercialCategory + '">' + item.commercialCategory + '</li>'
                })
                wrap.innerHTML = wrapStr
                wrap.setAttribute('data-param-key', 'category')
                wrap.setAttribute('label', 'Category')
                commonSearch.initTabSelect()
            } else {
                const categoryPrimary = document.querySelector('.item-wrap')
                wrapStr = '<ul class="select-item" data-param-key="category">'
                wrapStr += '<li class="is-active">All</li>'
                res[0].Data.forEach(item => {
                    wrapStr += '<li value="' + item.commercialCategory + '">' + item.commercialCategory + '</li>'
                })
                wrapStr += '</ul>'
                categoryPrimary.innerHTML = wrapStr
            }
            commonSearch.initFilterSearch()
        }
    }

    function searchUser() {
        let wrap, url
        if(gugeeGobal.isMobile) {
            wrap = document.querySelector('.gd-mobile-list__wrap')
            commonSearch.hideFilter()
        } else {
            wrap = document.querySelector('#searchTable tbody')
        }

        wrap.showLoading()
        const input = document.getElementById('insKeyword')
        params.name = (input.value)? input.value: undefined

        if(gugeeGobal.isLogin) {
            url = getEncodeUrl('/ins/brand', params)
        } else  {
            url = getEncodeUrl('/ins/brand/search', params)
        }

        commonSearch.getList(wrap, url, list => {
            let str = ''
            if(gugeeGobal.isMobile) {
                list.forEach(item => {
                    str += '<a href="/instagram/brand/' + item.enName + '">' +
	                    '<div class="user-item">' +
                        '<div class="user-info">' +
                        '<div class="avatar">' +
                            '<img class="head" src="' + getImage(item.logo, IMAGE_TYPE.MEDIA, IMAGE_SIZE.SMALL) + '" alt="logo">'
                    str += '</div>' +
                        '<div class="user-title">' +
	                        '<div class="top"><div class="title">' + item.enName + '</div></div>'
	                if(item.categoryName) {
	                    str += '<div class="category">' + item.categoryName + '</div>'
	                }
                    str  += '</div>' +
                        '</div>' +
                        '<div class="user-data">' +
                        '<div class="data-item">' +
	                        '<div class="label">Post</div>' +
	                        '<div class="num">' + numFormat(+item.mediaCount) + '</div>' +
                        '</div>' +
                        '<div class="data-item">' +
	                        '<div class="label">Likes</div>' +
	                        '<div class="num">' + numFormat(+item.likes) + '</div>' +
                        '</div>' +
                        '<div class="data-item">' +
	                        '<div class="label">Reviews</div>' +
	                        '<div class="num">'+ numFormat(+item.reviews) + '</div>' +
                        '</div>' +
                        '<div class="data-item">' +
	                        '<div class="label">Engagements</div>' +
	                        '<div class="num">' + numFormat(+item.engagements) + '</div>' +
                        '</div>' +
                        '</div>' +
                        '</div>' +
	                    '</a>'
                })
            } else {
                list.forEach(item => {
                    str += '<tr>' +
                        '<td class="tb-user">' +
                        '<div class="avatar">' +
                        '<img src="' + getImage(item.logo, IMAGE_TYPE.MEDIA, IMAGE_SIZE.SMALL) + '" alt="logo">'
                    str += '</div>' +
                        '<div class="label">' +
                        '<div class="title">' + item.enName
                    str += '</div>'
                    if(item.categoryName) {
                        str += '<div class="category">' + item.categoryName + '</div>'
                    }
                    str += '</div>' +
                        '</td>' +
                        '<td>' + numFormat(+item.mediaCount) + '</td>' +
                        '<td>' + numFormat(+item.likes) + '</td>' +
                        '<td>' + numFormat(+item.reviews) + '</td>' +
                        '<td>' + numFormat(+item.engagements) + '</td>'
                    str +=  '<td>' +
                        '<div class="td-action">' +
	                        '<div class="gd-popover" content="Analyze">' +
		                        '<div class="blue">' +
			                        '<a href="/instagram/brand/' + item.enName + '" target="_blank">' +
			                        '<i class="iconfont iconxiangqing"></i>' +
			                        '</a>' +
		                        '</div>' +
	                        '</div>'
                    if(item.collectId) {
                        str += '<div class="gd-popover" content="Remove from Favorite">' +
                            '<div class="icon-collect is-collect" data-id="' + item.id + '" data-fid="' + item.collectId + '">' +
                            '<i class="iconfont iconquxiaoshoucang33"></i>' +
                            '</div>' +
                            '</div>'
                    } else {
                        str += '<div class="gd-popover" content="Add to Favorite">' +
                            '<div class="icon-collect" data-id="' + item.id + '">' +
                            '<i class="iconfont iconshoucang"></i>' +
                            '</div>' +
                            '</div>'
                    }
                    str += '</div>' +
                        '</td>'
                     str += '</tr>'
                })
            }
            return str
        }, () => {
            const collectKey = 'bid', url = '/ins/fa/brand'
            document.querySelectorAll('.icon-collect').forEach(element => {
                element.addEventListener('click', event => {
                    if(gugeeGobal.isMobile) {
                        collectAction({
                            element,
                            url,
                            collectKey,
                            event,
                        })
                    } else {
                        collectAction({
                            element,
                            url,
                            collectKey,
                        })
                    }
                })
            })
        })
    }
</script>
</body>
</html>
